package com.thortec.farmsys.controller;

import com.thortec.farmsys.config.WebSecurityConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttribute;

public class LoginContorller {
    @Autowired
//    private SystemLogService systemLogService;

    @RequestMapping("/")
    public String index(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String account, ModelMap model) {

        model.addAttribute(account);
        return "login";
    }

    @RequestMapping("/login")
    public String login(ModelMap map) {

        return "login";
    }

//    @PostMapping(value = "login")
//    public String login(TUser tuser, ModelMap map, HttpServletRequest request, HttpSession session) {
////        SysUser sysUser1 = sysUserMapper.login(sysUser);
//        if (sysUser1 != null) {
//            session.setAttribute("account", WebSecurityConfig.SESSION_KEY);
//
//
//            return "/index";
//        } else {
//            map.put("msg", "账号或密码错误!");
//
//            return "login";
//        }
//    }
}